package cn.wolfcode.rockitmq.consumermode;


import org.apache.rocketmq.spring.annotation.MessageModel;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

/**
 * 消费者模式：集群和广播
 * BROADCASTING:广播模式  会给所有的消费者发一份
 * CLUSTERING: 集群模式 只会有一个消费者消费信息 默认值
 */
@Component
@RocketMQMessageListener(
        consumerGroup = "boot-consumer-demo",
        topic = "05-boot",
        //messageModel = MessageModel.BROADCASTING  //广播：都消费
        messageModel = MessageModel.CLUSTERING  //集群：只一个消费
)
public class Consumer2 implements RocketMQListener<String>{
    @Override
    public void onMessage(String msg) {
        System.out.println(" 2 消费信息：" + msg);
    }
}
